#pragma once

#include <WinSock2.h>
#include <string>

using namespace std;

struct CDNSSeedData 
{
	string name, host;
	CDNSSeedData(const string &strName, const string &strHost) : name(strName), host(strHost) {}
};


class CNetAddr
{
protected:
	unsigned char ip[16];

public:
	CNetAddr();
	CNetAddr(const struct in_addr& ipv4Addr);

	void Init();
	bool SetSpecial(const std::string &strName);
	bool GetInAddr(struct in_addr* pipv4Addr) const;
};

class CService : public CNetAddr
{
protected:
	unsigned short port;

public:
	CService();
	CService(const CNetAddr& ip, unsigned short port);
	CService(const struct in_addr& ipv4Addr, unsigned short port);
	
	explicit CService(const char *pszIpPort, int portDefault ,bool fAllowLookup =false);
	explicit CService(const std::string& strIpPort,int portDefault, bool fAllowLookup = false);


	void Init();
	bool GetSockAddr(struct sockaddr* paddr,int *addrlen) const;
};
